﻿@{
    Layout = null;
}

<!DOCTYPE html>


<html lang="zh-cn" class="login_page">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>房都市管理平台 - 登录</title>

    <!-- Bootstrap基础样式 -->
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
    <!-- 主题样式-->
    <link rel="stylesheet" href="/css/green.css" />
    <!-- tooltip -->
    <link rel="stylesheet" href="/lib/qtip2/jquery.qtip.min.css" />
    <!-- 主要样式 -->
    <link rel="stylesheet" href="/css/style.css" />

    <!-- favicon -->
    @*<link rel="shortcut icon" href="favicon.ico" />*@

    <link href='/css/googlefonts/OpenSans.css' rel='stylesheet' type='text/css'>

    <!--[if lte IE 8]>
            <link rel="stylesheet" href="/Content/css/ie.css" />
        <![endif]-->
    <!--[if lt IE 9]>
        <script src="/Scripts/ie/html5.js"></script>
        <script src="/Scripts/ie/respond.min.js"></script>
    <![endif]-->

    <script type="text/javascript">

      
        function login()
        {
            form1.submit();

        }
        function keyPress() {
            if (event.keyCode && event.keyCode == 13) {
              
                    form1.submit();
               
            }
        }

    </script>
</head>
<body onkeypress="keyPress()">

    <div class="login_box">

        @using (Html.BeginForm("UserLogin", "Home", FormMethod.Post, new { id = "form1" }))
        {
              @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))
            
            <div class="top_b">房都市管理平台登录</div>
            <div class="alert alert-info alert-login">
                请输入注册的用户名和密码登录
            </div>
            <div class="cnt_b">
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                        <input class="form-control input-sm" type="text" id="username" name="username" placeholder="用户名" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="password" name="password" placeholder="密码" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="checkbox-inline"><input type="checkbox" /> 记住我</label>
                </div>
            </div>
            <div class="btm_b clearfix">

                <button class="btn btn-default btn-sm " type="button" onclick="return login()" style="display: table;margin-left: auto; margin-right: auto;">登录</button>

            </div>
        }






    </div>

    <script src="/Scripts/jquery.min.js"></script>
    <script src="/Scripts/jquery.actual.min.js"></script>
    <script src="/lib/validation/jquery.validate.js"></script>

    <script src="/Scripts/ie/jquery.placeholder.min.js"></script>

    <script src="/bootstrap/js/bootstrap.min.js"></script>

    <script>


        $(document).ready(function () {

            var hdjsAlert = $("#hdjsAlert").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
            }
            $("#btnSMS").click(function () {
                setSMSTime($(this));

            });

            //* boxes animation
            form_wrapper = $('.login_box');
            function boxHeight() {
                form_wrapper.animate({ marginTop: (-(form_wrapper.height() / 2) - 24) }, 400);
            };
            form_wrapper.css({ marginTop: (-(form_wrapper.height() / 2) - 24) });
            $('.linkform a,.link_reg a').on('click', function (e) {
                var target = $(this).attr('href'),
                target_height = $(target).actual('height');
                $(form_wrapper).css({
                    'height': form_wrapper.height()
                });
                $(form_wrapper.find('form:visible')).fadeOut(400, function () {
                    form_wrapper.stop().animate({
                        height: target_height,
                        marginTop: (-(target_height / 2) - 24)
                    }, 500, function () {
                        $(target).fadeIn(400);
                        $('.links_btm .linkform').toggle();
                        $(form_wrapper).css({
                            'height': ''
                        });
                    });
                });
                e.preventDefault();
            });

            //* validation
            $('#login_form').validate({
                onkeyup: false,
                errorClass: 'error',
                validClass: 'valid',
                rules: {
                    username: { required: true, minlength: 3 },
                    password: { required: true, minlength: 3 }

                },
                highlight: function (element) {
                    $(element).closest('.form-group').addClass("f_error");
                    setTimeout(function () {
                        boxHeight()
                    }, 200)
                },
                unhighlight: function (element) {
                    $(element).closest('.form-group').removeClass("f_error");
                    setTimeout(function () {
                        boxHeight()
                    }, 200)
                },
                errorPlacement: function (error, element) {
                    $(element).closest('.form-group').append(error);
                }
            });


            $('input, textarea').placeholder();
            $("#btnLogin").click(function () {
                window.location.href = "/Realtor/RealtorInfo";
                return false;
            });
        });

        var wait = 120;//时间
        function setSMSTime(o, p) {//o为按钮的对象，p为可选，这里是120秒过后，提示文字的改变
            if (wait == 0) {
                o.removeAttr("disabled");
                o.html("点击发送验证码");//改变按钮中value的值
                //p.html("如果您在1分钟内没有收到验证码，请检查您填写的手机号码是否正确或重新发送");
                wait = 120;
            } else {
                o.attr("disabled", true);//倒计时过程中禁止点击按钮
                o.html(wait + "秒后重新获取验证码");//改变按钮中value的值
                wait--;
                setTimeout(function () {
                    setSMSTime(o, p);//循环调用
                },
                1000)
            }
        }
    </script>

</body>




</html>
